logopath = "#{Rails.root}/app/assets/images/RailsShopLogo.jpg"

bounding_box [200, 400], :width => bounds.width do
  font "Helvetica"
  text "Here's My Fancy Header", :align => :center, :size => 25
  pdf.image logopath, :width => 200
  stroke_horizontal_rule
end

bounding_box [600, 300], :width => bounds.width do
  font "Helvetica"
  stroke_horizontal_rule
  move_down(5)
  text "And here's a sexy footer", :size => 16
end


pdf.text "Order #{@cart.id}", :size => 30, :style => :bold
pdf.move_down(30)
items = [
    ["Produkt"],
    ["Anzahl"],
    ["Preis"],
    ["Total"]
]
items = @cart.cart_items.map do |item|
  [
      item.product.name,
      item.amount,
      item.product.price,
      item.amount * item.product.price
  ]
end

pdf.table items, :row_colors => ["FFFFFF", "DDDDDD"],
          :header => true

pdf.move_down(10)
pdf.text "TOTAL: #{sprintf("%0.2f", @cart.total)}", :size => 16, :style => :bold